/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "stdint.h"
/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define SDA_PT100_Pin GPIO_PIN_6
#define SDA_PT100_GPIO_Port GPIOA
#define SCL_PT100_Pin GPIO_PIN_7
#define SCL_PT100_GPIO_Port GPIOA
#define ST7735_DC_Pin GPIO_PIN_1
#define ST7735_DC_GPIO_Port GPIOB
#define ST7735_CS_Pin GPIO_PIN_12
#define ST7735_CS_GPIO_Port GPIOB
#define ST7735_RST_Pin GPIO_PIN_14
#define ST7735_RST_GPIO_Port GPIOB
#define ST7735_BL_Pin GPIO_PIN_12
#define ST7735_BL_GPIO_Port GPIOA

/* USER CODE BEGIN Private defines */
//选择通讯方式
#define HLW8110		1		//使能1--使用UART通讯(HLW8110)，使能0--使用SPI通讯(HLW8112)	
#define HLW8112		0		//使能1--使用UART通讯(HLW8112)，使能0--使用SPI通讯(HLW8110)	




//直流校正系数

//8112A通道或8110通道校正系数
#define D_CAL_U		1000/1000		//电压校正系数
#define D_CAL_A_I	1000/1000		//A通道电流校正系数
#define D_CAL_A_P	1000/1000		//A通道功率校正系数
#define D_CAL_A_E	1000/1000		//A通道电能校正系数


//8112 B通道校正系数
#define D_CAL_B_P	1000/1000		//B通道功率校正系数
#define D_CAL_B_I	1000/1000		//B通道电流校正系数
#define D_CAL_B_E	1000/1000		//B通道电能校正系数
	


#define TOU1 0X5A 
#define TOU2 0Xa5
#define TOU_LEN 0X05
#define TOU_CMD 0X82
#define SET_DATA 0X5000
#define TSET_DATA 0X5001
#define power_DATA 0X5186
#define SET_ZHIZHEN 0X5020
#define cover_DATA  0X5180
#define p_DATA 			0X5181
#define i_DATA 			0X5182
#define d_DATA			0X5183
#define t_DATA 			0X5184
#define  run 1
#define  stop 2
#define  huiliu 0
#define  hengwen 1
#define  zanting 3
#define  fan_on  HAL_GPIO_WritePin(fan_GPIO_Port, fan_Pin, 1);
#define  fan_off  HAL_GPIO_WritePin(fan_GPIO_Port, fan_Pin, 0);
extern uint8_t buzzer;
extern uint8_t run_status;
extern uint8_t buzzer_flag;
extern uint8_t buzzer_key;
extern uint8_t MODE_MODE;//����ģʽ�л����
extern int16_t PWM_VOL;
extern float TSET_y;
extern uint16_t timelineNew ;

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
